package com.mdd.common.enums.clue;

import java.util.HashMap;
import java.util.Map;

public enum ClueAllocationRecordStatusEnum {
    //状态 0待分配 1已分配  2跟进中 3已上岗 4已流失 5公海 9已作废
    ALLOCATION_STATUS(1,"已分配"),
    FOLLOW_UP_STATUS(2,"跟进中"),
    ON_DUTY_STATUS(3,"已上岗"),
    LOST_STATUS(4,"已流失"),
    VOIDED_STATUS(9,"已作废")
            ;

    private final Integer code;
    private final String msg;
    ClueAllocationRecordStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Map enumToMap() {
        Map map =new HashMap();
        map.put("name",msg);
        map.put("value",code);
        return map;
    }

    // 通过code获取枚举值
    static public ClueAllocationRecordStatusEnum getStatusByCode(Integer code) {
        for (ClueAllocationRecordStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null; // 或者可以抛出一个异常，表示找不到对应的枚举值
    }


}
